package com.test.learnopenglandroid.chapter1;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.test.learnopenglandroid.UIHelper;

public class Chapter1 {
    public static void init(LinearLayout chapterRoot, final LinearLayout buttonRoot, FrameLayout renderRoot){
        final LinearLayout btnRoot = buttonRoot;
        final FrameLayout frenderRoot = renderRoot;
        UIHelper.addTest(chapterRoot,"第一章 入门",new View.OnClickListener(){

            @Override
            public void onClick(View view) {
                btnRoot.removeAllViews();
                addAllTest(btnRoot,frenderRoot);
            }
        });
    }

    static private void addAllTest(LinearLayout buttonRoot,FrameLayout renderRoot){
        UIHelper.addTest(buttonRoot,"你好，窗口",new Test1HelloWindow(buttonRoot.getContext(),renderRoot));
        UIHelper.addTest(buttonRoot,"你好，三角形",new Test2HelloTriangle(buttonRoot.getContext(),renderRoot,Test2HelloTriangle.TestType.GLES20RendererNoVBO));
        UIHelper.addTest(buttonRoot,"你好，三角形 VBO",new Test2HelloTriangle(buttonRoot.getContext(),renderRoot,Test2HelloTriangle.TestType.GLES20RendererVBO));
        UIHelper.addTest(buttonRoot,"你好，三角形 EBO",new Test2HelloTriangle(buttonRoot.getContext(),renderRoot,Test2HelloTriangle.TestType.GLES20RendererVBOEBO));
        UIHelper.addTest(buttonRoot,"着色器",new Test3Shader(buttonRoot.getContext(),renderRoot,Test3Shader.TestType.GLES20RendererShader));
        UIHelper.addTest(buttonRoot,"着色器2",new Test3Shader(buttonRoot.getContext(),renderRoot,Test3Shader.TestType.GLES20RendererUniform));
        UIHelper.addTest(buttonRoot,"着色器 更多属性",new Test3Shader(buttonRoot.getContext(),renderRoot, Test3Shader.TestType.GLES20RendererMoreAttrib));
        UIHelper.addTest(buttonRoot,"纹理",new Test4Texture(buttonRoot.getContext(),renderRoot, Test4Texture.TestType.GLES20RendererTexture));
        UIHelper.addTest(buttonRoot,"纹理混合颜色",new Test4Texture(buttonRoot.getContext(),renderRoot, Test4Texture.TestType.GLES20RendererTextureColor));
        UIHelper.addTest(buttonRoot,"2贴图纹理混合颜色",new Test4Texture(buttonRoot.getContext(),renderRoot, Test4Texture.TestType.GLES20Renderer2TextureColor));
        UIHelper.addTest(buttonRoot,"变换",new Test5Transformations(buttonRoot.getContext(),renderRoot, Test5Transformations.TestType.GLES20RendererSquareScaleRotate));
        UIHelper.addTest(buttonRoot,"坐标系统",new Test6CoordinateSystems(buttonRoot.getContext(),renderRoot, Test6CoordinateSystems.TestType.GLES20RendererSquare3D));
        UIHelper.addTest(buttonRoot,"坐标系统2",new Test6CoordinateSystems(buttonRoot.getContext(),renderRoot, Test6CoordinateSystems.TestType.GLES20RendererMoreSquare3D));
        UIHelper.addTest(buttonRoot,"坐标系统 更多立方体",new Test6CoordinateSystems(buttonRoot.getContext(),renderRoot, Test6CoordinateSystems.TestType.GLES20RendererMore3DCubes));
        UIHelper.addTest(buttonRoot,"摄像机",new Test7Camera(buttonRoot.getContext(),renderRoot, Test7Camera.TestType.GLES20RendererMore3DCubes));
        UIHelper.addTest(buttonRoot,"摄像机 自由移动",new Test7Camera(buttonRoot.getContext(),renderRoot, Test7Camera.TestType.GLES20RendererCameraKeyboard));
    }
}
